package com.ad_hccm.dao.Week;

import com.ad_hccm.domain.Appendix.CompletionStatus;
import com.ad_hccm.domain.Week.AdverseReactionRecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * TODO 不良反应记录
 */
@Mapper
public interface AdverseReactionRecordDao {
    @Insert("insert into adverse_reaction_record value(#{id}, #{week}, #{isExitExperiment}, #{isAdverseEvent}, #{isSeriousAdverseEvent})")
    public boolean save(AdverseReactionRecord domain);

    @Update("update adverse_reaction_record set isExitExperiment = #{isExitExperiment}, isAdverseEvent = #{isAdverseEvent}, isSeriousAdverseEvent = #{isSeriousAdverseEvent} where id=#{id} and week = #{week}")
    public boolean update(AdverseReactionRecord domain);

    @Select("select * from adverse_reaction_record where id=#{id}")
    public List<AdverseReactionRecord> getById(String id);

    @Select("select * from adverse_reaction_record where id=#{id} and week>#{week}")
    public List<AdverseReactionRecord> getBigWeek(AdverseReactionRecord domain);

    @Select("select * from adverse_reaction_record")
    public List<AdverseReactionRecord> getAll();

    @Delete("delete from adverse_reaction_record where id = #{id} and week = #{week}")
    public boolean delete(AdverseReactionRecord domain);

    @Delete("delete from adverse_reaction_record where id = #{id} and week>#{week}")
    public boolean deleteBigWeek(AdverseReactionRecord domain);
}